package com.hyt.it.ogt.controller.ykcj.exam;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.domain.param.ExamPageParam;
import com.hyt.it.ogt.ykcj.domain.param.ExamTypeChangeParam;
import com.hyt.it.ogt.ykcj.domain.vo.EnterpriseExamVo;
import com.hyt.it.ogt.ykcj.domain.vo.ExamInfoVo;
import com.hyt.it.ogt.ykcj.service.exam.IExamInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 企业招聘考试信息Controller
 *
 * @author admin
 * @date 2021-06-18
 */
@Api(tags = "exam.10.其他考试信息", value = "其他考试信息请求接口")
@ApiSort(value = 110)
@RestController
@RequestMapping("/other/exam/info")
public class OtherExamInfoController extends BaseController {
    @Autowired
    private IExamInfoService examInfoService;

    /**
     * 查询考试信息列表
     */
    @ApiOperation(value = "查询考试信息列表", response = EnterpriseExamVo.class)
    @GetMapping("/list")
    public TableDataInfo list(ExamPageParam examPageParam) {
        startPage();
        List<ExamInfoVo> otherExamVos = examInfoService.pageOtherExamInfoList(examPageParam);
        TableDataInfo dataTable = getDataTable(otherExamVos);
        dataTable.setRows(examInfoService.pageOtherExamInfoListExchange((List<ExamInfoVo>) dataTable.getRows()));
        return dataTable;
    }

    /**
     * 修改考试类型
     */
    @ApiOperation(value = "修改考试类型", response = EnterpriseExamVo.class)
    @PostMapping("/typeChange")
    public AjaxResult typeChange(@RequestBody @Validated ExamTypeChangeParam examTypeChangeParam) {
        examInfoService.examTypeChange(examTypeChangeParam);
        return AjaxResult.success();
    }

}


